﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zj.OpenAuth.Domain.Core;
using Zj.OpenAuth.DTO.Common;

namespace Zj.OpenAuth.App
{
    /// <summary>
    /// entity and data transfer object mapping
    /// </summary>
    public class MapperExt
    {
        public static void Initialize()
        {
            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap<Menu, MenuDTO>();
                cfg.CreateMap<MenuDTO, Menu>();
                cfg.CreateMap<Department, DepartmentDTO>();
                cfg.CreateMap<DepartmentDTO, Department>();
                cfg.CreateMap<RoleDTO, Role>();
                cfg.CreateMap<Role, RoleDTO>();
                cfg.CreateMap<RoleMenuMappingDTO, RoleMenuMapping>();
                cfg.CreateMap<RoleMenuMapping, RoleMenuMappingDTO>();
                cfg.CreateMap<UserDTO, User>();
                cfg.CreateMap<User, UserDTO>();
                cfg.CreateMap<UserRoleMappingDTO, UserRoleMapping>();
                cfg.CreateMap<UserRoleMapping, UserRoleMappingDTO>();
            });
        }
    }
}
